package cn.nubia.admin.common.mybatis.bean;

public  class OtherBeansRef{
        /**
         * 本表关联其他表字段,如:templateId
         */
        public String refIdFieldName;
        /**
         * 关联的类
         */
        public Class clazz;
        /**
         * 需要拷贝的字段
         */
        public String[] includeNames;

        public static OtherBeansRef[] buildRefs(String[] fieldNames , Class[] classes , String[][] includeNames) {
            if (fieldNames.length != classes.length) {
                return new OtherBeansRef[0];
            }

            OtherBeansRef[] refs = new OtherBeansRef[fieldNames.length];
            for (int i= 0; i< fieldNames.length ; i++) {
                refs[i] = new OtherBeansRef(fieldNames[i] , classes[i] , includeNames[i]);
            }
            return refs;
        }


        public OtherBeansRef(String fieldName, Class clazz ,String[] includeNames) {
            this.refIdFieldName = fieldName;
            this.clazz = clazz;
            this.includeNames = includeNames;
        }

        public String getRefIdFieldName() {
            return refIdFieldName;
        }

        public void setRefIdFieldName(String refIdFieldName) {
            this.refIdFieldName = refIdFieldName;
        }

        public Class getClazz() {
            return clazz;
        }

        public void setClazz(Class clazz) {
            this.clazz = clazz;
        }

        public String[] getIncludeNames() {
            return includeNames;
        }

        public void setIncludeNames(String[] includeNames) {
            this.includeNames = includeNames;
        }
    }